﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;

namespace BYManageInfoSystem
{
    public partial class Form_DiscountMgr : DockContent
    {
        private DGBY.BLL.DiscountTab m_bllDiscountTab = new DGBY.BLL.DiscountTab();
        private int m_nDiscountTabID = 0;
        public Form_DiscountMgr()
        {
            InitializeComponent();
        }

        private void buttonModifyPort_Click(object sender, EventArgs e)
        {
            DGBY.Model.DiscountTab modelDiscountTab = m_bllDiscountTab.GetModel(m_nDiscountTabID);
            modelDiscountTab.DiscountFactor = Convert.ToDecimal(this.textBoxPort.Text);
            Frm_Main.m_dtDiscountFactor = modelDiscountTab.DiscountFactor;
            m_bllDiscountTab.Update(modelDiscountTab);

            Frm_Main.Log2DB(this.Text, "修改", modelDiscountTab.DiscountFactor.ToString());
            MessageBox.Show("数据修改成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        private void Form_DiscountMgr_Load(object sender, EventArgs e)
        {
            DataSet ds = m_bllDiscountTab.GetAllList();

            this.textBoxPort.Text = ds.Tables[0].Rows[0]["DiscountFactor"].ToString();
            m_nDiscountTabID = (int)ds.Tables[0].Rows[0]["DiscountTabID"];
        }
    }
}
